package com.jiutong.meipenggang.http.present;

import android.content.Context;

import com.jiutong.meipenggang.entity.InvestDetailBean;
import com.jiutong.meipenggang.http.model.interfaces.InvestRecordBiz;
import com.jiutong.meipenggang.http.model.requests.MeiLiCaiFragmentRequest;
import com.jiutong.meipenggang.http.subscribers.ProgressSubscriber;
import com.jiutong.meipenggang.http.subscribers.SubscriberOnNextListener;

import java.util.HashMap;

/**
 * @author Veken
 * @date on 2017/12/21 11:23
 * @describe
 */

public class InvestRecordPresent {

    private InvestRecordBiz investRecordBiz;
    private Context mContext;
    private MeiLiCaiFragmentRequest meiLiCaiFragmentRequest;

    public InvestRecordPresent(Context mContext, InvestRecordBiz investRecordBiz) {
        this.mContext = mContext;
        this.investRecordBiz = investRecordBiz;
        meiLiCaiFragmentRequest = new MeiLiCaiFragmentRequest();
    }

    public void getInvestRecordInfo(){
        SubscriberOnNextListener onNextListener = new SubscriberOnNextListener<InvestDetailBean>() {
            @Override
            public void onNext(InvestDetailBean object) {
                investRecordBiz.onSuccess(object);
            }

            @Override
            public void onError(Throwable e) {

            }
        };
        HashMap<String,Object> hashMap = new HashMap<>();
        hashMap.put("OPT",investRecordBiz.getOpt());
        hashMap.put("bidId",investRecordBiz.bidId());
        hashMap.put("currPage",investRecordBiz.currPage());
        meiLiCaiFragmentRequest.getInvestRecordInfo(new ProgressSubscriber(onNextListener,mContext),hashMap);
    }
}
